import request from '@/utils/request'
const UpmsProofService = {
  state: {},

  mutations: {},

  actions: {
    /**
     * 密钥分页
     */
    proofPage({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.get('proof/page', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 密钥保存
     */
    proofSave({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('proof/save', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 密钥更新
     */
    proofUpdate({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('proof/update/' + params.id, params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 密钥启用&禁用
     */
    proofChangeIsState({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('proof/changeIsState/' + params.id, params.isDisabled).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 密钥删除
     */
    proofRemove({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('proof/remove', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default UpmsProofService
